var app = angular.module('MyApp', ["ngRoute"]);
var cfz = "cfz2";
(function(){
	console.log('测试配置执行');
	var routeConfig = {
		'default' : '/index.html',
		'map' : {
			'/index.html' : {
				ctrl : 'index',
				tpl : 'index'
			},
			'/page1.html' : {
				ctrl : 'page1',
				tpl : 'page1'
			},
			'/page2.html' : {
				ctrl : 'page2',
				tpl : 'page2'
			},
		}
	};
	app.config(function($routeProvider, $locationProvider){
		console.log('app配置开始');
		var map = routeConfig['map'];
        for (var uri in map){
        	$routeProvider.when(uri, {
        		templateUrl : '/' + uri.tpl + '.html',
        		controller : uri.ctrl + 'Controller'
        	});
        }
        $routeProvider.otherwise({
        	redirectTo: routeConfig["default"]
        });
        $locationProvider.html5Mode(true);
        console.log('app配置完成');
    });
})();